package com.kstudio.ksnapshot;

import android.app.Application;
import android.content.SharedPreferences;
import android.os.Environment;

public class KSnapshot extends Application {

    private String KCurrentPath;
    private String KStoragePath;

    @Override
    public void onCreate() {
        super.onCreate();

        SharedPreferences prefs = getSharedPreferences("KSnapshotSettings", MODE_PRIVATE);
        KCurrentPath = prefs.getString("KCurrentPath", Environment.getExternalStorageDirectory().toString());
        KStoragePath = prefs.getString("KRepositoryPath", Environment.getExternalStorageDirectory()+"/KSnapShot/");
    }

    public String getCurrentPath() {
        return KCurrentPath;
    }

    public String getStoragePath() {
        return KStoragePath;
    }

    public void setCurrentPath(String path) {
        SharedPreferences prefs = getSharedPreferences("KSnapshotSettings", MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("KCurrentPath", path);
        editor.commit();

        KCurrentPath = path;
    }

    public void setStoragePath(String path) {
        SharedPreferences prefs = getSharedPreferences("KSnapshotSettings", MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("KRepositoryPath", path);
        editor.commit();

        KStoragePath = path;
    }
}
